package com.xidian.zhiancloud.controller.riskcontrol.riskevaluate;

import com.xidian.zhiancloud.controller.base.BaseController;
import com.xidian.zhiancloud.dto.ResultDTO;
import com.xidian.zhiancloud.enums.GeneralResponseEnums;
import com.xidian.zhiancloud.model.riskcontrol.TRiskEvaMethSetSeverList;
import com.xidian.zhiancloud.service.riskcontrol.riskevaluate.TRiskEvaMethSetSeverService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * 风险管控-系统设置-风险评价方法设置-七字段
 */
@RestController
@RequestMapping("/triskevamethsetsever")
public class TRiskEvaMethSetSeverController extends BaseController {

    @Autowired
    TRiskEvaMethSetSeverService tRiskEvaMethSetSeverService;

    /**
     * 风险管控-系统设置-风险评价方法设置列表
     * @param evaMethodSetId 评价方法设置ID
     * @param criteria 判定准则
     * @return 返回 ResultDTO 对象
     */
    @RequestMapping("/getTRiskEvaMethSetSeverList")
    public ResultDTO getTRiskEvaMethSetSeverList(
            @RequestParam("evaMethodSetId") String evaMethodSetId,
            @RequestParam("criteria") String criteria){
        Long companyid=this.getSessionUserCompanyId();
        return ResultDTO.successOf(tRiskEvaMethSetSeverService.
             getTRiskEvaMethSetSeverList(companyid,evaMethodSetId,criteria),
             GeneralResponseEnums.SUCCESS);
    }

    /**
     * 系统设置-风险评价方法设置添加
     * @param evaMethodSetId 评价方法设置ID
     * @param criteria 判定准则
     * @return 返回 ResultDTO 对象
     */
    @RequestMapping("/addTRiskEvaMethSetSever")
    public ResultDTO addTRiskEvaMethSetSever(
     @RequestParam("evaMethodSetId") String evaMethodSetId,
     @RequestParam("criteria") String criteria,
     TRiskEvaMethSetSeverList tREMSetSever){
        Long companyId=this.getSessionUserCompanyId();
        tREMSetSever.setCompanyId(companyId);
        tREMSetSever.setEvaMethodSetId(evaMethodSetId);
        tREMSetSever.setCriteria(criteria);
        tRiskEvaMethSetSeverService.addTRiskEvaMethSetSever(tREMSetSever);
        return ResultDTO.successOf(GeneralResponseEnums.SUCCESS);
    }

    /**
     * 系统设置-风险评价方法设置修改
     * @param id 风险评价方法设置表ID
     * @return 返回 ResultDTO 对象
     */
    @RequestMapping("/updateTRiskEvaMethSetSever")
    public ResultDTO updateTRiskEvaMethSetSever(@RequestParam("id") String id,
           TRiskEvaMethSetSeverList tREMSetSever){
        tRiskEvaMethSetSeverService.updateTRiskEvaMethSetSever(id,tREMSetSever);
        return ResultDTO.successOf(GeneralResponseEnums.SUCCESS);
    }

    /**
     * 系统设置-风险评价方法设置删除
     * @param id 风险评价方法设置表ID
     *
     * @return 返回 ResultDTO 对象
     */
    @RequestMapping("/deleteTRiskEvaMethSetSever")
    public ResultDTO deleteTRiskEvaMethSetSever (@RequestParam("id") String id){
        tRiskEvaMethSetSeverService.deleteTRiskEvaMethSetSever (id);
        return ResultDTO.successOf(GeneralResponseEnums.SUCCESS);
    }


}
